<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Client\UserController;
use App\Http\Controllers\Client\KeyController;
use \App\Http\Controllers\Client\ImageController;
use \App\Http\Controllers\Client\TreatmentCategoryController;
use \App\Http\Controllers\Client\TreatmentController;
use \App\Http\Controllers\Client\RegionController;
use \App\Http\Controllers\Client\StoreController;
use \App\Http\Controllers\Client\AuthController;
use \App\Http\Controllers\Client\AvailableBookingController;
use \App\Http\Controllers\Client\AppointmentController;
use \App\Http\Controllers\Client\GiftController;
use \App\Http\Controllers\Client\FeedbackController;
use \App\Http\Controllers\Test\JsonPController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
    return view('index');
});

Route::get('/en',function(){
    return view('en');
});

Route::get('/doc', function () {
    return view('doc');
});



//客户端接口
Route::prefix('client') ->group(function(){

    //user
    Route::prefix('user')->group(function(){
        //服务端实现小程序登录（获取openid）
        Route::any('onLogin',[UserController::class,'onLogin']);
        Route::any('userInfo',[UserController::class,'userInfo']);
        Route::any('updateTrueName',[UserController::class,'updateTrueName']);
        Route::any('updatePhone',[UserController::class,'updatePhone']);
        Route::any('updateAvatarUrl',[UserController::class,'updateAvatarUrl']);
        Route::any('updateGender',[UserController::class,'updateGender']);
    });

    //key
    Route::prefix('key')->group(function(){
        //通过授权码获取关键信息
        Route::post('getInfoByAuthCode',[KeyController::class,'getInfoByAuthCode']);
    });

    //treatment_categories
    Route::prefix('treatmentCategory')->group(function (){
        Route::post("allTreatmentCategories",[TreatmentCategoryController::class,'allTreatmentCategories']);
        Route::post('treatmentCategoryForListPage',[TreatmentCategoryController::class,'treatmentCategoryForListPage']);
    });

    //image
    Route::prefix('image')->group(function (){
        //获取tabBar资料
        Route::post('getTabBar',[ImageController::class,'getTabBar']);
        //获取banner图
        Route::post("getBanner",[ImageController::class,'getBanner']);
        //获取门店页头图
        Route::post("getStore",[ImageController::class,'getStore']);
        //上传图片到七牛云
        Route::post('uploadAvatarToQiNiu',[ImageController::class,'uploadAvatarToQiNiu']);
    });

    //treatment
    Route::prefix('treatment')->group(function (){
        Route::post('treatmentListForHome',[TreatmentController::class,'treatmentListForHome']);
        Route::post('treatmentForDetailPage',[TreatmentController::class,'treatmentForDetailPage']);
        Route::post('treatmentListByCategoryName',[TreatmentController::class,'treatmentListByCategoryName']);
        Route::post('treatmentListBySearchVal',[TreatmentController::class,'treatmentListBySearchVal']);
        Route::post('treatmentNameListForBookPage',[TreatmentController::class,'treatmentNameListForBookPage']);
    });

    //region
    Route::prefix('region')->group(function (){
        Route::post('allRegion',[RegionController::class,'allRegion']);
        Route::post('regionListForBookPage',[RegionController::class,'regionListForBookPage']);
    });

    //store
    Route::prefix('store')->group(function(){
        Route::post('storeListForStorePage',[StoreController::class,'storeListForStorePage']);
        Route::post('storeListForBookPage',[StoreController::class,'storeListForBookPage']);
        Route::post('allStoreListForBookPage',[StoreController::class,'allStoreListForBookPage']);
    });

    //权限相关接口
    Route::prefix('auth')->group(function(){
        Route::post('sendCode',[AuthController::class,'sendCode']);
        Route::post('checkCode',[AuthController::class,'checkCode']);
    });

    //获取某天的可预约日期
    Route::prefix('availableBooking')->group(function (){
        Route::post('bookingTiming',[AvailableBookingController::class,'bookingTiming']);
    });

    //预约信息
    Route::prefix('appointment')->group(function(){
        Route::post('saveAppointment',[AppointmentController::class, 'saveAppointment']);
        Route::post('unfinishedAppointmentList',[AppointmentController::class, 'unfinishedAppointmentList']);
    });

    //gift
    Route::prefix('gift')->group(function(){
        Route::post('getRedeemCode',[GiftController::class,'getRedeemCode']);
    });

    //意见反馈
    Route::prefix('feedback')->group(function (){
        Route::post('submitFeedback',[FeedbackController::class,'submitFeedback']);
    });



});

//测试
Route::prefix('test')->group(function (){
    Route::get('jsonp',[JsonPController::class,'index']);
});
